package {{package_name}}.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import {{package_name}}.converter.{{ pascal_case }}Converter;
import {{package_name}}.model.dtos.{{ pascal_case }}DTO;
import {{package_name}}.model.pos.{{ pascal_case }}PO;
import {{package_name}}.model.querys.{{ pascal_case }}Query;
import {{package_name}}.model.vos.{{ pascal_case }}VO;
import com.capybara.account.result.Result;
import com.capybara.account.result.ResultPage;
import com.capybara.account.result.ResultSet;
import {{package_name}}.service.I{{ pascal_case }}Service;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List; 

/**
 * {{ table_comm }}控制器
 */
@RestController
@AllArgsConstructor
@RequestMapping("/account/{{ kebab_case }}")
public class {{ pascal_case }}Controller {
     
    private final I{{ pascal_case }}Service {{ camel_case }}Service;

    /**
     * 查询列表
     */
    @GetMapping
    public ResultPage<{{pascal_case}}VO> findPage({{pascal_case}}Query param) {
        Page<{{pascal_case}}VO> page = {{ camel_case }}Service.findPage(param);
        return ResultSet.page(page);
    }
    
    /**
     * 查询单个
     */
    @GetMapping("{id}")
    public Result<{{ pascal_case }}VO> getById(@PathVariable String id) {
        {{ pascal_case }}PO po = {{ camel_case }}Service.getById(id);
        {{ pascal_case }}VO vo = {{ pascal_case }}Converter.INSTANCE.poToVO(po);
        return ResultSet.go(vo);
    }

     /**
     * 保存-新增
     */
    @PostMapping()
    public Result<?> save(@RequestBody @Valid {{pascal_case}}DTO param) {
        {{ pascal_case }}PO po = {{ pascal_case }}Converter.INSTANCE.dtoToPO(param);
        boolean b = {{ camel_case }}Service.save(po);
        return ResultSet.operation(b);
    }

    /**
     * 保存-修改
     */
    @PutMapping()
    public Result<?> updateById(@RequestBody @Valid {{pascal_case}}DTO param) {
        {{ pascal_case }}PO po = {{ pascal_case }}Converter.INSTANCE.dtoToPO(param);
        boolean b = {{ camel_case }}Service.updateById(po);
        return ResultSet.operation(b);
    }

    /**
     * 删除
     */
    @DeleteMapping()
    public Result<?> del(@RequestParam List<String> ids) {
        boolean b = {{ camel_case }}Service.removeByIds(ids);
        return ResultSet.operation(b);
    }

    /**
     * 导出
     */
    @GetMapping("export")
    public void export({{pascal_case}}Query param, HttpServletResponse response) {
        {{ camel_case }}Service.export(param, response);
    }

}